from peewee import SqliteDatabase


class SqliteUtil:

    @staticmethod
    def getDatabase(filePath,read_only:bool)->SqliteDatabase:
        if read_only:
            filePath = f"file:{filePath}?mode=ro"
            return SqliteDatabase(filePath,uri=True,check_same_thread = False)
        else:
            return SqliteDatabase(filePath)